/* 
 * File:   Widget.h
 * Author: marcin
 *
 * Created on 26 kwiecień 2011, 00:51
 */

#ifndef WIDGET_H
#define	WIDGET_H

#include <QWidget>
#include <QTableWidget>
#include <QTextEdit>
#include <QLineEdit>
#include <QLabel>
#include <QPushButton>
#include "muParser.h"
#include "muParserInt.h"
#include "include/qwt3d_gridplot.h"
#include "include/qwt3d_function.h"
#include "window.h"
#include "PSO.h"

using namespace std;
using namespace mu;
using namespace Qwt3D;

class Rosenbrock : public Function {
public:
    Parser parser;
    double xVal, yVal;

    Rosenbrock(GridPlot& pw)
    : Function(pw) {

        parser.DefineVar("x", &this->xVal);
        parser.DefineVar("y", &this->yVal);
        
    }

    double operator()(double x, double y) {
         this->xVal = x;
        this->yVal = y;
         return parser.Eval();
       // return log((1 - x)*(1 - x) + 100 * (y - x * x)*(y - x * x)) / 8;
    }
};

class Plot : public GridPlot {
public:
    Plot();
    Rosenbrock* rosenbrock;
};



class Widget: public QWidget{
     Q_OBJECT
public:
    Widget();
    
     virtual ~Widget();
     PSO* pso;
     Plot* plot;
     QLabel* label;
     QLineEdit* lineedit;
     QPushButton* button;
     QPushButton* iteruj;
     QTextEdit* memo;
     QTableWidget* table ;
public slots:
   void Rysuj();
   void Iteruj();
   
private:

};

#endif	/* WIDGET_H */

